package StudyCode.summary.mycollection;

import java.util.ArrayList;
import java.util.List;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertListIntegerToArrayInt {
	public static void main(String[] argv) {
		List src = java.util.Arrays.asList(1, 2);
		System.out.println(java.util.Arrays.toString(toArray(src)));
	}

	public static int[] toArray(List<Integer> src) {
		int[] res = new int[src.size()];
		for (int i = 0; i < src.size(); i++) {
			res[i] = src.get(i);
		}
		return res;
	}

	public static long[] toArray(ArrayList<Long> src) {
		long[] res = new long[src.size()];
		for (int i = 0; i < src.size(); i++) {
			res[i] = src.get(i);
		}
		return res;
	}
}
